package org.ranshiyan.util;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.ranshiyan.pojo.Teacher;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class ExcelUtil {

    public static List<Teacher> OutExcel(String url){
        ArrayList<Object> ts = new ArrayList<Object>();
        File filePath = new File(url);
        InputStream fis;
        try{
            fis = new FileInputStream(filePath);
            XSSFWorkbook sheets = new XSSFWorkbook(fis);
            XSSFSheet sheetAt = sheets.getSheetAt(0);
            for(int numRow=1;numRow<=(sheetAt.getPhysicalNumberOfRows()-1);numRow++){
                XSSFRow xssfRow = sheetAt.getRow(numRow);
                if(xssfRow!=null){
                    XSSFCell id = xssfRow.getCell(0);

                    System.out.println(id+"==");
                    Teacher teacher = new Teacher();

                }
            }


        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
